# !/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd

# 删除列
if __name__ == '__main__':

    df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C': [7, 8, 9], 'D': [7, 8, 9]})
    df.drop('A', axis=1, inplace=True)
    print(df)

    df2 = df[['B', 'C']]
    print(df2)

    del df2['B']
    # 不存在列删除报错
    # del df2['A']
    print(df2)

    df2.pop('C')
    print(df2)

    df.drop(['B', 'C'], axis=1, inplace=True)
    print(df)

    print(df.head(1))
